<%include /admin/inc/header.html%>
<%include /admin/inc/aside.html%>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            首页
            <small>新闻管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">新闻管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">新闻列表</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table id="example2" class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>名称</th>
                                <th>所属栏目</th>
                                <th>发布人</th>
                                <th>发布时间</th>
                                <th>是否置顶</th>
                                <th>是否推荐</th>
                                <th>操作</th>
                            </tr>

                            </thead>
                            <tbody>
                            <%locals.pg.items.forEach(function(news){%>
                            <tr id="data-news-<%=news.id%>">
                                <td><%=news.id%></td>
                                <td>
                                    <a target="_blank" href="/news/<%=news.id%>"><%=news.title%></a>
                                </td>
                                <td>
                                    <a href="../column/<%=news.columnId%>"><%=news.columnId%></a></td>
                                <td><%=news.author%></td>
                                <td><%=news.createdAt%></td>
                                <td><%=news.isTop%></td>
                                <td><%=news.isRecommend%></td>
                                <td>
                                    <a href="/admin/news/save?id=<%=news.id%>">编辑</a>
                                    &nbsp;&nbsp;
                                    <a onclick="return window.dao.doDelete('news', '<%=news.id%>', true)">删除</a>
                                </td>
                            </tr>
                            <%})%>
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="8">
                                    <a href="./save" class="btn btn-primary">添加</a>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<%include /admin/inc/footer.html%>